import axios from "axios";
// import store from "@/store";

const request = axios.create({
    baseURL: process.env.VUE_APP_BASE_API,
    timeout: 30000,
    headers: {'X-Custom-Header': 'zsmj'},
    withCredentials: true,
    crossDomain: true
});

console.log(process.env.VUE_APP_BASE_API);

const errorFn = (error) => {
    const {status, data} = error.response;
    console.log(status);
    console.log(data);
};

request.interceptors.request.use((config) => {
    config.headers['Access-Control-Allow-Origin'] = '*';
    // config.headers['Content-Type'] = 'application/json';
    // config.headers['Authorization'] = 'Bearer ' + store.getters.getAccessToken;
    return config;
}, errorFn);

export default request;
